# OpenGL 通用计算库

DEFINES +=GLGPLIBDLL
contains(DEFINES,GLGPLIBDLL){
    TEMPLATE = lib
    CONFIG += dll
#    unix:CONFIG += shared
} else {
    TEMPLATE = app
}

CONFIG +=  console c++11  # 请求使用c++11特性  以便使用c++11 新集成的标准mutex类库
CONFIG -= app_bundle
CONFIG -= qt

DEFINES += OPENGL_GPDLLEXPORT

GLFW_includepath = "./GLFW/include"
GLFW_libpath = "GLFW/lib-vc2015"

GLAD_includepath = "./GLAD/include"
GLAD_srcpath = "./GLAD/src"
#message($${GLAD_srcpath})

INCLUDEPATH  += \
                $${GLFW_includepath} \
                $${GLAD_includepath} \

win32{
LIBS += \
        $${PWD}/$${GLFW_libpath}/glfw3.lib  \ # glfw3.lib是静态链接  glfw3dll.lib是动态链接  $${PWD}是必须的因为加入lib文件不能使用相对目录
        -lopengl32 -luser32 -lshell32 -lgdi32  \           # 必须要添加一些windows自带库 否则会报错 例如  : LNK2019: 无法解析的外部符号 __imp_TranslateMessage，该符号在函数 createHelperWindow 中被引用

#pragma comment (lib,"opengl32.lib")
#pragma comment (lib,"User32.lib")
#pragma comment (lib,"Gdi32.lib")
#pragma comment (lib,"shell32.lib")
}

unix{
}

#message($$LIBS)

CONFIG(debug, debug|release){
    QMAKE_LFLAGS += /NODEFAULTLIB:MSVCRT  # 忽略链接到 MSVCRT.lib ，调试版本可能由于外部glfw库的影响 链接了 MSVCRT.lib 和 MSVCRTD.lib两个版本的库，所以要忽略非调试版本
}else:CONFIG(release, debug|release){

}


SOURCES += \
        $${GLAD_srcpath}/glad.c \
    opengl_gp_lib.cpp \
    shadercodetext.cpp \
    main.c

HEADERS += \
    linmath.h \
    opengl_gp_lib.h \
    shadercodetext.h

ProjectName = OpenGL_GP
LibsBuildDir = libs-build

CONFIG(debug, debug|release){
  DESTDIR = $${PWD}/../$${LibsBuildDir}/debug
  copy_libs_dest.path = $${PWD}/../../Build-$${ProjectName}/debug
  final_intall.path = $${PWD}/../../Build-$${ProjectName}/Install/debug
}else{
  DESTDIR = $${PWD}/../$${LibsBuildDir}/release
  copy_libs_dest.path = $${PWD}/../../Build-$${ProjectName}/release
  final_intall.path = $${PWD}/../../Build-$${ProjectName}/Install/release
}
OBJECTS_DIR = $${DESTDIR}/tmp/$${TARGET}
MOC_DIR = $${DESTDIR}/moc/$${TARGET}
RCC_DIR = $${DESTDIR}/rcc/$${TARGET}
UI_DIR = $${DESTDIR}/ui/$${TARGET}

export_include_install.path = $${DESTDIR}/include
export_include_install.files += '$${PWD}/opengl_gp_lib.h' \


win32{
copy_libs_dest.files = '$${DESTDIR}/$${TARGET}.dll'
final_intall.files = $$copy_libs_dest.files
#message($$final_intall.path)
#message($$final_intall.files)
INSTALLS += copy_libs_dest \
            export_include_install \
#    final_intall \
}
